﻿<%@ WebHandler Language="C#" Class="Valid" %>

using System;
using System.Web;

public class Valid : IHttpHandler {

    public void ProcessRequest(HttpContext context)
    {
        string strDomain = context.Request["host"];
        bool blnValid = true;

        try
        {
            blnValid = true;
        }
        catch (Exception ex)
        {
            blnValid = false;
        }

        context.Response.ContentType = "application/json";
        context.Response.ContentEncoding = System.Text.Encoding.UTF8;
            context.Response.Write("{\"state\":\"1\"}");

    }

    ///<summary>
    /// 读取数据
    ///</summary>
    ///<param name="path">路径</param>
    ///<param name="node">节点</param>
    ///<param name="attribute">属性名，非空时返回该属性值，否则返回串联值</param>
    ///<returns>string</returns>
    /**************************************************
     * 使用示列:
     * XMLRead(path, "/Node", "")
     * XMLRead(path, "/Node/Element[@Attribute='Name']", "Attribute")
     ************************************************/
    public static string XMLRead(string path, string node, string attribute)
    {
        string value = "";
        try
        {
            System.Xml.XmlDocument doc = new System.Xml.XmlDocument();
            doc.Load(path);
            System.Xml.XmlNode xn = doc.SelectSingleNode(node);
            value = (attribute.Equals("") ? xn.InnerText : xn.Attributes[attribute].Value);
        }
        catch { }
        return value;
    }
 
    public bool IsReusable {
        get {
            return false;
        }
    }

}